<?php
namespace BP\Sys\FrmUI;
require_once("BP/En/Map.php");
class ExtImg extends EntityMyPK {
	public function getHisUAC () 
	{
		$uac = new UAC();
		$uac->IsInsert =  FALSE ;
		$uac->IsUpdate =  TRUE ;
		$uac->IsDelete =  TRUE ;
		return $uac;
	}
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public static function constructor__String ($mypk) // [String mypk]
	{
		$me = new self();
		$me->setMyPK($mypk);
		$me->Retrieve();
		return $me;
	}
	public function getKeyOfEn () 
	{
		return $this->GetValStringByKey(MapAttrAttr::$KeyOfEn);
	}
	public function setKeyOfEn ($value) // [String value]
	{
		$this->SetValByKey(MapAttrAttr::$KeyOfEn, $value);
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map("Sys_FrmImg", "装饰图片");
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetEnType($EnType->Sys);
		$map->IndexField = MapAttrAttr::$FK_MapData;
		$map->AddMyPK();
		$map->AddTBString(MapAttrAttr::$FK_MapData, NULL, "表单ID",  TRUE ,  TRUE , 0, 200, 20);
		$map->AddTBString(MapAttrAttr::$KeyOfEn, NULL, "对应字段",  TRUE ,  TRUE , 0, 200, 20);
		$map->AddTBString(FrmImgAttr::$Name, NULL, "中文名称",  TRUE ,  TRUE , 0, 500, 20);
		$map->AddDDLSysEnum(FrmImgAttr::$ImgSrcType, 0, "图片来源",  TRUE ,  TRUE , FrmImgAttr::$ImgSrcType, "@0=本地@1=URL");
		$map->AddTBString(FrmImgAttr::$ImgPath, NULL, "图片路径",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$strs = "本机的图片路�?:";
		$strs += " \n 1.您可以使�? ＠baseBase 或�?�＠+字段英文名作为变量来标识文件路径.";
		$strs += " \n 2.注意＠需要半角字�?.";
		$strs += " \n 3.例如:＠basePath/DataUser/UserIcon/＠QingJiaRenID.png";
		$map->SetHelperAlert(FrmImgAttr::$ImgPath, $strs);
		$map->AddTBString(FrmImgAttr::$ImgURL, NULL, "图片URL",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$map->AddTBString(FrmImgAttr::$LinkURL, NULL, "连接到URL",  TRUE ,  FALSE , 0, 200, 20,  TRUE );
		$map->AddTBString(FrmImgAttr::$LinkTarget, "_blank", "连接目标",  TRUE ,  FALSE , 0, 200, 20);
		$map->AddTBInt(FrmImgAttr::$ImgAppType, 0, "应用类型",  FALSE ,  FALSE );
		$map->AddDDLSQL(MapAttrAttr::$GroupID, 0, "显示的分�?", MapAttrString::getSQLOfGroupAttr(),  TRUE );
		$map->AddTBInt(MapAttrAttr::$ColSpan, 0, "单元格数�?",  FALSE ,  TRUE );
		$map->AddDDLSysEnum(MapAttrAttr::$TextColSpan, 1, "文本单元格数�?",  TRUE ,  TRUE , "ColSpanAttrString", "@1=�?1个单元格@2=�?2个单元格@3=�?3个单元格@4=�?4个单元格");
		$map->AddDDLSysEnum(MapAttrAttr::$RowSpan, 1, "行数",  TRUE ,  TRUE , "RowSpanAttrString", "@1=�?1个行@2=�?2行@3=�?3�?");
		$map->AddTBInt(MapAttrAttr::$UIWidth, 0, "宽度",  TRUE ,  FALSE );
		$map->AddTBInt(MapAttrAttr::$UIHeight, 0, "高度",  TRUE ,  FALSE );
		$this->set_enMap($map);
		return $this->get_enMap();
	}
	protected function afterInsertUpdateAction () 
	{
		$imgAth = FrmImg::constructor__();
		$imgAth->setMyPK($this->getMyPK());
		$imgAth->RetrieveFromDBSources();
		$imgAth->Update();
		if (($DataType->IsNullOrEmpty($this->getKeyOfEn()) ==  FALSE ))
		{
			$attr = MapAttrString::constructor__String($this->getMyPK());
			$attr->SetValByKey(MapAttrAttr::$ColSpan, $this->GetValStrByKey(MapAttrAttr::$ColSpan));
			$attr->SetValByKey(MapAttrAttr::$TextColSpan, $this->GetValStrByKey(MapAttrAttr::$TextColSpan));
			$attr->SetValByKey(MapAttrAttr::$RowSpan, $this->GetValStrByKey(MapAttrAttr::$RowSpan));
			$attr->SetValByKey(MapAttrAttr::$Name, $this->GetValStrByKey(FrmImgAttr::$Name));
			$attr->SetValByKey(MapAttrAttr::$X, $this->GetValStrByKey(FrmImgAttr::$X));
			$attr->SetValByKey(MapAttrAttr::$Y, $this->GetValStrByKey(FrmImgAttr::$Y));
			$attr->Update();
		}
		parent->afterInsertUpdateAction();
	}
	protected function afterDelete () 
	{
		$attr = MapAttrString::constructor__();
		$attr->setMyPK($this->getMyPK());
		$attr->Delete();
		parent->afterDelete();
	}
}
?>
